package com.atguigu.lease.common.exceptionHandle;

import com.atguigu.lease.common.result.Result;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class GlobalException {
    @ExceptionHandler(BusiException.class)
    public Result busiExceptionHandle(BusiException e){
        e.printStackTrace();
        return Result.fail(500, e.getMessage()+e.getCause(),null);
    }

    @ExceptionHandler(Exception.class)
    public Result exceptionHandle(Exception e){
        e.printStackTrace();
        return Result.fail(500, e.getMessage()+e.getCause(),null);
    }

}
